package com.lyl.security.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Mr.Luo
 * @date 2022-09-19 17:33
 * @desc
 */
@RestController
public class TestController {

    @PreAuthorize("hasAuthority('hello')")
    @GetMapping("/hello")
    public String hello() {
        return "hello,world";
    }

    @GetMapping("/hello2")
    @PreAuthorize("hasAuthority('admin')")
    public String hello2() {
        return "hello,world----------2";
    }
}
